import random
#from game.monster.models import individual, group
#from game.combat.models import combat
from game.damage.models import damage

def standardToHit(caller, target, toHit=0):
    """calculates if the caller hits the target"""
    attack = caller.getStatBonus('str')
    attack += toHit
    defence = target.getStatBonus('dex')
    totalModifier = attack - defence
    attackRoll = random.randint(1,20)
    
    if attackRoll+totalModifier >= 10:
        return True
    return False



def alwaysHit(caller, target):
    return True

def standardStrDamage(caller, target, attack):
    """calculates damage of Strength based attack and inflicts it to the target"""
    damage = attack.damage
    strBonus = caller.StatBonus('str')
    damage.power += strBouns
    damageInflicted = target.addDamage(damage)
    return damageInflicted

def singlePointOfDamage(self, target):
    dmg = damage(amount=1, power=1)
    damageInflicted = dmg.applyDamage(target.individual)
    return damageInflicted
    
def testHit(caller, target):
    return 10

def fail(caller, target):
    print "Boo"